home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / faq-s.zip / FILEEDIT.PAS < prev    next >
Pascal/Delphi Source File  |  1990-05-09  |  10KB  |  373 lines

  1. Uses Dos,Crt;
  2. Label 1,2;
  3. Type
  4.      lstr=string[80];
  5.      mstr=string[30];
  6.      sstr=string[15];
  7.      Str2=String[2];
  8.  
  9.      udrec=record                        {This is only for version 1.18 and}
  10.        sentby:mstr;                      {below.  It will change with a future}
  11.        when,whenrated:longint;           {version to add the items commented}
  12.        filename:sstr;                    {out.}
  13.        path:string[50];
  14.        points:integer;
  15.        filesize:longint;
  16.        descrip,dlpw:lstr;
  17.        extdesc:string[255];
  18.        downloaded:integer;
  19.        newfile,specialfile:boolean;
  20. (*     progname:string[20];         { This is the full name of the program}
  21.        ofwhat1,ofwhat2:byte;        { These are for "disk x of y"}
  22.        ptsgiven:integer;            { How many validation points awarded}  *)
  23.      end;
  24.  
  25. Var Infile:File of udrec;
  26.     conference:str2;
  27.     datadir:String[80];
  28.     Area:Str2;
  29.     Recs:udrec;
  30.     Fsize  :Longint;
  31.     Inf2:file;
  32.     FileNum:Integer;
  33.     Num,a,b,c,d,e:Integer;
  34.     Flag,Flag2:Boolean;
  35.     Command,C2,Answer:Char;
  36.     Counter:Integer;
  37.     Spec1:String;
  38.     Specfile:File;
  39.  
  40.   Procedure Erase_Disk_File;
  41.     begin
  42.       Spec1:=recs.path+Recs.filename;
  43.       Assign(Specfile,spec1);
  44.       Erase(Specfile);
  45.     End;
  46.  
  47.   Procedure Delete_File;
  48.     Begin
  49.      If Filenum=Counter-1 then begin
  50.         Seek(Infile,filenum);
  51.         Truncate(Infile);
  52.      End Else Begin
  53.      For A:=1 to Counter-1 do Begin
  54.       seek(Infile,a);
  55.       read(Infile,recs);
  56.       seek(Infile,a-1);
  57.       write(Infile,Recs)
  58.     end;
  59.     seek (Infile,counter-1);
  60.     truncate (Infile);
  61.     End;
  62.     Close(Infile);
  63.   end;
  64.  
  65.   Procedure Add_File;
  66.    Begin
  67.     GotoXy(40,12);Write('File Number: ',Counter);
  68.     With Recs do
  69.     Begin
  70.       Gotoxy(23,13);Readln(filename);
  71.       Gotoxy(23,14);Readln(path);
  72.       Gotoxy(23,15);Readln(points);
  73.       Gotoxy(23,16);Readln(sentby);
  74.       Gotoxy(23,17);Readln(dlpw);
  75.       Gotoxy(23,18);Readln(downloaded);
  76.       Gotoxy(23,19);Write('FALSE');
  77.       Newfile:=False;
  78.       Gotoxy(23,20);Write('FALSE');
  79.       Specialfile:=False;
  80.       Gotoxy(23,21);Readln(descrip);
  81.       Gotoxy(23,22);Readln(extdesc);
  82.       Assign(Inf2,Path+Filename);
  83.       Reset(inf2);
  84.     End;
  85.     Fsize:=Filesize(Inf2);
  86.     Close(Inf2);
  87.     Seek(Infile,Counter);
  88.     Write(Infile,Recs);
  89.    End;
  90.  
  91.   Procedure Format_Data_Area;
  92.     Begin
  93.      For A:=13 to 24 do begin
  94.          GotoXy(23,A);Write('                                                     ');
  95.          End;
  96.     End;
  97.  
  98.   Procedure Commands;
  99.     Begin
  100.       TextColor(14);
  101.       Gotoxy(5,5);
  102.       Writeln('[A] Change Name     [B] Change Path          [C] Change Points');
  103.       Gotoxy(5,6);
  104.       Writeln('[D] Sent By         [E] DL Password          [F] Times DL''ed');
  105.       Gotoxy(5,7);
  106.       Writeln('[G] New File Rating [H] Special File Rating  [I] Description');
  107.       Gotoxy(5,8);
  108.       Writeln('[J] Ext Description [K] Delete File          [L] Add File');
  109.       TextColor(12);
  110.       Writeln('                   [Page Up & Page Down] Change Area');
  111.       Writeln('       [Uarrow] Next File                     [Darrow] Next File');
  112.       TextColor(11);
  113.       Gotoxy(53,12);Write('   ');
  114.       GotoXy(40,12);Write('File Number: ',Filenum);
  115.       Gotoxy(62,12);Writeln('[Q] Quit & Save');
  116.     end;
  117.  
  118.   Procedure Write_Area;
  119.     Begin
  120.       Seek(Infile,Filenum);
  121.       Write(Infile,Recs);
  122.       If Flag=TRUE then Begin
  123.         Close(Infile);
  124.         Halt;
  125.       End;
  126.       If Flag2=TRUE then Begin
  127.         Close(Infile);
  128.       End;
  129.     end;
  130.  
  131.   Procedure Open_Area(Area:Str2);
  132.     Begin
  133.       Assign(Infile,'AREA'+Area+'.'+conference);
  134.       Reset(Infile);
  135.       Counter:=0;
  136.       While not eof (Infile) do Begin
  137.         Read(Infile,recs);
  138.         Counter:=Counter+1;
  139.         Filenum:=0;
  140.       end;
  141.     end;
  142.  
  143.   Procedure Next_File;
  144.    Begin
  145.     Filenum:=Filenum+1;
  146.     If filenum>counter then filenum:=0;
  147.    End;
  148.  
  149.   Procedure List_Data;
  150.     Begin
  151.     Gotoxy(1,13);
  152.      TextColor(4);
  153.      If FileNum>=Counter then Filenum:=0;
  154.      If Filenum<0 then filenum:=Counter-1;
  155.      Seek(infile,Filenum);
  156.      Read(Infile,Recs);
  157.      With recs do Begin
  158.        Writeln('File Name           : ',Filename);
  159.        Writeln('File Path           : ',Path);
  160.        Writeln('File Points         : ',Points);
  161.        Writeln('Sent By             : ',sentby);
  162.        Writeln('Password            : ',dlpw);
  163.        Writeln('Downloded           : ',Downloaded,' Times');
  164.        Writeln('New File Rating     : ',Newfile);
  165.        Writeln('Special Rating      : ',Specialfile);
  166.        Writeln('Description         : ',descrip);
  167.        Writeln('Extended Description: ',extdesc);
  168.      End;
  169.     End;
  170.  
  171.  
  172.   Begin
  173.   clrscr;
  174.   textcolor(14);
  175.   write('What is the full path of your data directory: ');
  176.   readln(datadir);
  177.   chdir(datadir);
  178.  
  179. 1: ClrScr;
  180.    TextColor(13);
  181.    Gotoxy(28,2);
  182.    Write('Celerity File Editor');
  183.    TextColor(14);
  184.     For a:=1 to 79 do
  185.      Begin
  186.        Gotoxy(a,3);
  187.        Write('─');
  188.      end;
  189.     For a:=1 to 79 do
  190.      Begin
  191.        Gotoxy(a,1);
  192.        Write('─');
  193.      end;
  194.    TextColor(9);
  195.    For a:=1 to 79 do
  196.      Begin
  197.        Gotoxy(a,4);
  198.        Write('─');
  199.      end;
  200.     For a:=1 to 79 do
  201.      Begin
  202.        Gotoxy(a,11);
  203.        Write('─');
  204.      end;
  205.    Writeln;
  206.    Flag2:=False;
  207.    Flag:=False;
  208.    a:=0;
  209.    Filenum:=0;
  210.    Num:=0;
  211.    Counter:=0;
  212.    C2:='+';
  213.    Command:='+';
  214.    TextColor(11);
  215.    Gotoxy(1,12);
  216.    Write('Area Number: ');
  217.    TextColor(10);
  218.    Readln(area);
  219.    gotoxy(1,12);
  220.    write('Conference Number:');
  221.    textcolor(10);
  222.    readln(conference);
  223. 2: TextColor(4);
  224.    Open_Area(Area);
  225.    List_Data;
  226.    Commands;
  227.    Repeat
  228.    GotoXY(1,1);
  229.    Command:=Readkey;
  230.    Command:=Upcase(Command);
  231.    Case Command of
  232.    'A':Begin
  233.          Gotoxy(23,13);
  234.          For a:=1 to 50 do Write(' ');
  235.          Gotoxy(23,13);
  236.          Readln(recs.filename);
  237.        End;
  238.    'B':Begin
  239.          Gotoxy(23,14);
  240.          For a:=1 to 50 do Write(' ');
  241.          Gotoxy(23,14);
  242.          Readln(recs.path);
  243.        End;
  244.  
  245.    'C':Begin
  246.          Gotoxy(23,15);
  247.          For a:=1 to 50 do Write(' ');
  248.          Gotoxy(23,15);
  249.          Readln(recs.points);
  250.        End;
  251.  
  252.    'D':Begin
  253.          Gotoxy(23,16);
  254.          For a:=1 to 50 do Write(' ');
  255.          Gotoxy(23,16);
  256.          Readln(recs.sentby);
  257.        End;
  258.  
  259.    'E':Begin
  260.          Gotoxy(23,17);
  261.          For a:=1 to 50 do Write(' ');
  262.          Gotoxy(23,17);
  263.          Readln(recs.dlpw);
  264.        End;
  265.  
  266.    'F':Begin
  267.          Gotoxy(23,18);
  268.          For a:=1 to 50 do Write(' ');
  269.          Gotoxy(23,18);
  270.          Readln(recs.downloaded);
  271.        End;
  272.  
  273.    'G':Begin
  274.          Gotoxy(23,19);
  275.          For a:=1 to 50 do Write(' ');
  276.          Gotoxy(23,19);
  277.          If Recs.Newfile=TRUE then Recs.Newfile:=False else
  278.          If Recs.Newfile=False then Recs.Newfile:=True;
  279.          Write_Area;
  280.          List_Data;
  281.        End;
  282.    'H':Begin
  283.          Gotoxy(23,20);
  284.          For a:=1 to 50 do Write(' ');
  285.          Gotoxy(23,20);
  286.          If Recs.specialfile=TRUE then Recs.specialfile:=False else
  287.          If Recs.specialfile=False then recs.specialfile:=True;
  288.          Write_Area;
  289.          List_Data;
  290.        End;
  291.    'I':Begin
  292.          Gotoxy(23,21);
  293.          For a:=1 to 50 do Write(' ');
  294.          Gotoxy(23,21);
  295.          Readln(recs.descrip);
  296.        End;
  297.    'J':Begin
  298.          Gotoxy(23,22);
  299.          For a:=1 to 50 do Write(' ');
  300.          Gotoxy(23,22);
  301.          Readln(recs.extdesc);
  302.        End;
  303.    'Q':Begin
  304.          Flag:=True;
  305.          Write_Area;
  306.        End;
  307.  
  308.      'K':Begin
  309.            GotoXy(1,24);Write('                     ');
  310.            Gotoxy(1,24);Write('Erase this file from the disk? ');
  311.            Answer:=Readkey;
  312.            Answer:=Upcase(Answer);
  313.            If Answer='Y' then Erase_Disk_File;
  314.            Gotoxy(1,24);
  315.            Write('Delete this file from area list? ');
  316.            Answer:=Readkey;
  317.            Answer:=Upcase(Answer);
  318.            If Answer='Y' then Delete_file Else Begin
  319.            GotoXy(1,24);Write('                                ');
  320.            End;
  321.            Goto 2;
  322.          End;
  323.  
  324.      'L':Begin
  325.            Write_Area;
  326.            Format_Data_Area;
  327.            Add_File;
  328.            Close(Infile);
  329.            Format_Data_Area;
  330.            Goto 2;
  331.          End;
  332.  
  333.      #0:Begin
  334.          C2:=Readkey;
  335.          Case C2 of
  336.            #72:Begin
  337.                  Write_Area;
  338.                  FileNum:=FileNum+1;
  339.                  Format_Data_Area;
  340.                  list_Data;
  341.                  Commands;
  342.                End;
  343.  
  344.            #80:Begin
  345.                  Write_Area;
  346.                  FileNum:=FileNum-1;
  347.                  Format_Data_Area;
  348.                  list_Data;
  349.                  Commands;
  350.                End;
  351.  
  352.            #73:Begin
  353.                  Flag2:=True;
  354.                  Write_Area;
  355.                  Goto 1;
  356.                  End;
  357.            #81:Begin
  358.                  Flag2:=True;
  359.                  Write_Area;
  360.                  Goto 1;
  361.                  End;
  362.            End;
  363.    End;
  364.    End;
  365.    Until Flag=True;
  366.   end.
  367.  
  368.  
  369.  
  370.  
  371.   (*  This program, too, was lifted from the TCS editor.  Do what you like
  372.       with it, as the interface really stinks right now, but everything you
  373.       need to work with is here.  *)